/*
 * =====================================================================================
 *
 *       Filename:  cl_id.hxx
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  02/28/2011 04:37:22 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Ken Chen (Ken), chen_kenz@emc.com
 *        Company:  EMC
 *
 * =====================================================================================
 */

#ifndef _CL_ID_HXX_
#define _CL_ID_HXX_

#include <cstdint>
#include <atomic>
#include <ostream>

namespace neo
{
class CLId
{
public:
  static const CLId allocate(void);
  bool operator==(const CLId& id) const;
  const std::string toString(void) const;

private:
  CLId(uint64_t id);

private:
  friend std::ostream& operator<<(std::ostream& os, const CLId id);
  uint64_t m_id;

private:
  // KENTODO... for now use static member to gen next id.
  static std::atomic<uint64_t> m_currentId;
};

// For debug purpose
inline std::ostream& operator<<(std::ostream& os, const CLId id)
{
  return os << id.m_id;
}

} // neo

#endif //_CL_ID_HXX_

